package com.project.slsx.adapter;

import android.widget.LinearLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.project.slsx.R;

import java.util.ArrayList;

public class TextAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    private ArrayList<Boolean> selected = new ArrayList<>();

    public ArrayList<Boolean> getSelected() {
        return selected;
    }

    public TextAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder holder, String item) {
        holder.setText(R.id.tv_title, item);
        LinearLayout bg = holder.getView(R.id.ll_bg);
        bg.setSelected(selected.get(holder.getLayoutPosition()));
    }

    public void setSelected(ArrayList<Boolean> categorySelected) {
        this.selected = categorySelected;
        notifyDataSetChanged();
    }
}
